/**
 * 
 */
package s2h.view;

import s2h.controller.UserController;
import s2h.model.UserModel;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author WIN7
 *
 */
public class UserView extends ActionSupport {

	/**
	 * 
	 */
	private UserModel user;
	public UserModel getUser() {
		return user;
	}
	public void setUser(UserModel user) {
		this.user = user;
	}
	private static final long serialVersionUID = 1L;
	public String execute() {
		return SUCCESS;
	}
	public String login() {
		UserController usercontrol = new UserController();
		if (usercontrol.doLogin(getUser()))
		{
			return SUCCESS;
		}else
		{
			addActionError(getText("error.login"));
			return ERROR;
		}
		
		
	}
	public String addUser() {
		
		UserController usercontrol = new UserController();
		usercontrol.add(getUser());
		return SUCCESS;
		
		
	}
}
